'use strict';

/**
 * @description 菜单表模型
 * */
module.exports = app => {
  const { STRING, INTEGER } = app.Sequelize;

  const Menu = app.model.define('menu', {
    name: {
      type: STRING(20),
      allowNull: false,
      comment: '菜单名',
    },
    href: {
      type: STRING(50),
      allowNull: false,
      comment: '菜单地址',
    },
    type: {
      type: STRING(20),
      allowNull: false,
      comment: '菜单类型',
    },
    parentId: {
      type: INTEGER,
      allowNull: true,
      defaultValue: 0,
      comment: '菜单父元素',
    },
  });

  return Menu;
};
